package util

import (
	"math/rand"
	"strings"
	"time"
)

const (
	alphabet = "abcdefghijklmnopqrstuvwxyz"
)

func init() {
	rand.Seed(time.Now().UnixNano())
}

//获取随机Int数值
func RandomInt(min, max int64) int64 {
	return min + rand.Int63n(max-min+1)
}

//获取随机字符串
func RandomString(n int) string {
	var str strings.Builder
	k := len(alphabet)

	for i := 0; i < n; i++ {
		item := alphabet[rand.Intn(k)]
		str.WriteByte(item)
	}
	return str.String()
}
